package com.zhq.apputil.widget.config;

import android.graphics.Color;


import com.zhq.apputil.utils.StringUtil;

import androidx.viewpager.widget.ViewPager;


/**
 * Created by Administrator on 2017/12/7.
 * 指示器建造者模式
 */
public class TabBarItemBean {
    private int position;
    private Integer[] barType;
    private String[] type;
    private String[] title;
    private int fontNormalColor;
    private int fontPressedColor;
    private int indicatorColor;
    private int indicatorHeight;
    private float selectFontSize;
    private float unSelectFontSize;
    private ViewPager viewPager;
    private boolean isRoundUnderIndicator;
    private boolean isScrolled;
    private boolean isTitleBold;

    public int getPosition() {
        return position;
    }

    public int getIndicatorHeight() {
        return indicatorHeight;
    }

    public Integer[] getBarType() {
        return barType;
    }

    public String[] getType() {
        return type;
    }

    public CharSequence[] getTitle() {
        return title;
    }

    public int getFontNormalColor() {
        return fontNormalColor;
    }

    public int getFontPressedColor() {
        return fontPressedColor;
    }

    public int getIndicatorColor() {
        return indicatorColor;
    }

    public void setTitle(String[] title) {
        this.title = title;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public ViewPager getViewPager() {
        return viewPager;
    }

    public float getSelectFontSize() {
        return selectFontSize;
    }

    public float getUnSelectFontSize() {
        return unSelectFontSize;
    }

    public boolean isScrolled() {
        return isScrolled;
    }

    public boolean isTitleBold() {
        return isTitleBold;
    }

    public boolean isRoundUnderIndicator() {
        return isRoundUnderIndicator;
    }

    public TabBarItemBean(Builder builder) {
        this.position = builder.position;
        this.barType = builder.barType;
        this.type = builder.type;
        this.title = builder.title;
        this.fontNormalColor = builder.fontNormalColor;
        this.fontPressedColor = builder.fontPressedColor;
        this.indicatorColor = builder.indicatorColor;
        this.indicatorHeight = builder.indicatorHeight;
        this.isRoundUnderIndicator = builder.isRoundUnderIndicator;
        this.isScrolled = builder.isScrolled;
        this.viewPager = builder.viewPager;
        this.selectFontSize = builder.selectFontSize;
        this.unSelectFontSize = builder.unSelectFontSize;
        this.isTitleBold = builder.isTitleBold;
    }

    public static class Builder {
        private int position = 0;
        private Integer[] barType;
        private String[] type;
        private String[] title;
        private int fontNormalColor = Color.parseColor("#242D34");
        private int fontPressedColor = Color.parseColor("#F86A6A");
        private int indicatorColor = Color.parseColor("#F86A6A");
        private int indicatorHeight = 2;
        private float selectFontSize = 15;
        private float unSelectFontSize = 13;
        private ViewPager viewPager;
        private boolean isRoundUnderIndicator;
        private boolean isScrolled;
        private boolean isTitleBold;


        public Builder setSelectPosition(int position) {
            this.position = position;
            return this;
        }

        public Builder setTabBarTitle(String[] title) {
            this.title = title;
            return this;
        }

        public Builder setTabBarRoundUnderIndicator(boolean isRoundUnderIndicator) {
            this.isRoundUnderIndicator = isRoundUnderIndicator;
            return this;
        }

        public Builder setTabBarNormalColor(String fontNormalColor) {
            this.fontNormalColor = Color.parseColor(StringUtil.isEmpty(fontNormalColor) ? "#242D34" : fontNormalColor);
            return this;
        }

        public Builder setTabBarPressedColor(String fontPressedColor) {
            this.fontPressedColor = Color.parseColor(StringUtil.isEmpty(fontPressedColor) ? "#F86A6A" : fontPressedColor);
            return this;
        }

        public Builder setTabBarIndicatorColor(String indicatorColor) {
            this.indicatorColor = Color.parseColor(StringUtil.isEmpty(indicatorColor) ? "#F86A6A" : indicatorColor);
            return this;
        }

        public Builder setTabBarSelectFontSize(float selectFontSize) {
            this.selectFontSize = selectFontSize;
            return this;
        }

        public Builder setTabBarUnSelectFontSize(float unSelectFontSize) {
            this.unSelectFontSize = unSelectFontSize;
            return this;
        }

        public Builder setTabBarIndicatorHeight(int indicatorHeight) {
            this.indicatorHeight = indicatorHeight;
            return this;
        }

        public Builder setTabBarPressedType(String[] type) {
            this.type = type;
            return this;
        }

        public Builder setTabBarPressedType(Integer[] type) {
            this.barType = type;
            return this;
        }


        public Builder setTabBarViewPager(ViewPager viewPager) {
            this.viewPager = viewPager;
            return this;
        }

        public Builder setTabBarScrolled(boolean isScrolled) {
            this.isScrolled = isScrolled;
            return this;
        }

        public Builder setTabBarTitleBold(boolean isTitleBold) {
            this.isTitleBold = isTitleBold;
            return this;
        }

        public TabBarItemBean build() {
            return new TabBarItemBean(this);
        }
    }


}
